package com.bj.dz.converters;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class DateConverter implements Converter<String, Date>{

	@Override
	public Date convert(String strDate) {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		Date date=null;
		try {
			date=sdf.parse(strDate);
		} catch (ParseException e) {
			System.out.println("转换失败...");
		}
		return date;
	}
}
